import React, { useState } from "react";
import { Button,DotLoading } from "antd-mobile";



const HOC = (Component: any) => (props: any) => {
  const [number, setNumber] = useState<number>();
 
  return (
    <Component
      number={`点赞${number}次`}
      onChange={(value: number) => {
        setNumber(value);
      }}
      {...props}
    />
  );
};

const Index: React.FC<any> = (props) => {
  const [count, setCount] = useState<number>(0);
  const { number, onChange } = props;
  return (
    <div>
      <Button color="primary" onClick={() => setCount((res) => res + 1)}>
        {" "}
        累积点赞{" "}
      </Button>
      <div>{count}</div>
      <Button color="primary" onClick={() => onChange(count)}>
        {" "}
        同步{" "}
      </Button>
      <div>{number}</div>
    </div>
  );
};

export default HOC(Index);
